{include 'public/header.html'}
<div class="main-content">
<div class="page-content">
  <div class="page-content-area" style="opacity: 0.8;"> <br>
    <div class="page-header">
      <h1> 老师管理 <small><i class="ace-icon fa fa-angle-double-right"></i> {if $row.id}编辑{else}新增{/if}老师 </small> </h1>
    </div>
    <div class="row">
      <div class="panel panel-default">
        <div class="panel-body table-responsive">
          <form method="post" class="form-horizontal" role="form" id="submitform" onsubmit="return false">
            <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="name">姓名</label>
                <input type="text" class="form-control" id="name" name="name" value="{$row.name}">
              </div>
            </div>
            <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="name">电话</label>
                <input type="text" class="form-control" id="phone" name="phone" value="{$row.phone}">
              </div>
            </div>
            <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="appsecret">课程</label>
                <input type="text" class="form-control" id="kecheng" name="kecheng" value="{$row.kecheng}">
              </div>
            </div>
            <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="name">园长</label>
                <select name="isdirector" id="isdirector" class="form-control">
                  <option value="">请选择</option>
                  <option value="0" {if '0'===$row.isdirector}selected{/if} >否</option>
                  <option value="1" {if '1'===$row.isdirector}selected{/if} >是</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="appsecret">卡号</label>
                <input type="text" class="form-control" id="iccode" name="iccode" value="{$row.iccode}">
              </div>
            </div>
            <div class="form-group">
              <div class="col-md-6">
                <button type="submit" class="btn btn-primary btn-lg btn-submit">提交</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
var isbusy = false;
$(function(){
	$('#submitform').validate({
		focusInvalid: true,
		rules: {
			//title: {
				//required: true
			//}
		}
	});
	$('.btn-submit').click(function(){
		if(!$('#submitform').valid())return false;
		if(isbusy)return false;
		isbusy = true;
		tooltipbox.show('正在执行操作...');
		$.post(location.href, $('#submitform').serialize(), function(res){
		    if(res.code == 1){
				location.href = '{siteurl("con=admin/teacher")}';
			}
			tooltipbox.show(res.msg);	
			isbusy = false;
		}, 'json').error(function(a, b, c){
			tooltipbox.show('数据或网络错误');
			isbusy = false;
		});
	});
});
</script> 
{include 'public/footer.html'} 